import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../../../base/get/get_common_view.dart';
import '../../../util/save/sp_util.dart';
import 'package:get/get.dart';
import '../../../routes/routes.dart';

import '../../../../res/r.dart';
import '../../../res/global_user_info.dart';
import '../splash_controller.dart';

class SplashAnimWidget extends GetCommonView<SplashController> {
  const SplashAnimWidget({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return AnimatedOpacity(

      onEnd: () {
        // GlobalUserInfo.userinfo = SpUtil.getUserInfo() == null
        //     ? UserEntity(
        //         phoneNumber: '',
        //         customerId: '',
        //         token: '',
        //         customerOpenId: '',
        //         nickName: '',
        //         jobNumber: '',
        //         idCard: '',
        //         avatar: '', userSig: "")
        //     : SpUtil.getUserInfo()!;
        // // Get.offAllNamed(Routes.mainPage);
        // final CoreServicesImpl _coreInstance = TIMUIKitCore.getInstance();
        //
        // if(GlobalUserInfo.isLogin()){
        //   SensorsAnalyticsFlutterPlugin.login(GlobalUserInfo.userinfo.customerId);
        //   _coreInstance.login(
        //       userID: GlobalUserInfo.userinfo.jobNumber.isEmpty
        //           ? GlobalUserInfo.userinfo.phoneNumber
        //           : GlobalUserInfo.userinfo.jobNumber,
        //       userSig: GlobalUserInfo.userinfo.userSig);
        // }




        // _coreInstance.login(
        //     userID: "bingo",
        //     userSig:"eJyrVgrxCdYrSy1SslIy0jNQ0gHzM1NS80oy0zLBwkmZeen5UInilOzEgoLMFCUrQxMDA3MTU0tzE4hMakVBZlEqUNzU1NTIwMAAIlqSmQsSMzMzM7U0MTYyhZqSmQ40t8IryMDJLSk0uLw4xC-K2bDUrTIyNcfXpdwiLzS-3DA-v9g8r9Q4P0bfvyDZVqkWAG1EMoI_");



        Get.toNamed(Routes.loginPage);

        // Get.offNamed(
        //     SpUtil.getUserInfo() == null ? Routes.loginPage : Routes.mainPage);
      },
      opacity: controller.opacityLevel,
      duration: const Duration(milliseconds: 800),
      child: Center(
          child: Container(
            alignment: Alignment.topCenter,
            width: 150.w,
            height: 300.h,
            child: Image.asset(
              R.b_icon1,
              fit: BoxFit.fitWidth,
            ),
          ),
          ),
    );
  }
}
